//
//  HYOUMyView.m
//  BestGift
//
//  Created by 温晓宇 on 16/1/15.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "HYOUMyView.h"

@interface HYOUMyView ()

@end

@implementation HYOUMyView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self create];
    }
    return self;
}
-(void)create{
    
    UIView *head = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, 64)];
    head.backgroundColor = RGBA(231, 46, 67, 1);
    [self addSubview:head];
    
    UIButton *left = [UIButton buttonWithType:UIButtonTypeCustom];
    //    left.backgroundColor = [UIColor whiteColor];
    [left setImage:[UIImage imageNamed:@"iconfont-jiantou"] forState:UIControlStateNormal];
    left.frame = CGRectMake(10, 20, 32, 40);
    [self addSubview:left];
    [left addTarget:self action:@selector(leftAction:) forControlEvents:UIControlEventTouchUpInside];
    
    
    UIImageView *myImage = [[UIImageView alloc]initWithFrame:CGRectMake(WIDTH / 2 - 50, HEIGHT / 2 - 200, 100, 100)];
    myImage.image = [UIImage imageNamed:@"AppIcon40x40@3x"];
    [self addSubview:myImage];
    
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH / 2 - 50, HEIGHT / 2 - 100, 100, 50)];
    label.text = @"Best Gift";
    label.textAlignment = NSTextAlignmentCenter;
    [self addSubview:label];
}
-(void)leftAction:(UIButton *)btn{
    [self.delegate popMyView];
}

@end
